<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style lang="less">
          body {
            font-family: Arial, sans-serif;
            background-color: #f2f2f2;
        }

        h1 {
            text-align: center;
            margin-top: 30px;
        }

        table {
            width: 80%;
            margin: 30px auto;
            border-collapse: collapse;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        th, td {
            padding: 10px;
            text-align: center;
            border: 1px solid #ccc;
        }

        th {
            background-color: #f2f2f2;
        }

        a {
            text-decoration: none;
            color: #333;
            margin:0 10px;
        }

        a:hover {
            color: #ff0000;
        }
    </style>
</head>
<body>
    <h1 align="center">
        会员管理系统
   （ <a href='addUser.php'>增加会员</a>）
    </h1>
    <table class="gridtable" border="1" cellspacing="0" cellpadding="0" id="userList" align="center">
        <tr align="center">
            <td>用户名</td>
            <td>密码</td>
            <td>性别</td>
            <td>年龄</td>
            <td>爱好</td>
            <td>操作</td>
        </tr>
        <?php
        require_once 'conn.php';
        $result = mysqli_query($con, 'select * from user');
        $userList = array();
        while ($rs = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
            $userList[] = $rs;
        }
        foreach ($userList as $user) {
            echo "
                <tr>
                    <td> " . $user['name'] . " </td>
                    <td> " . $user['password'] . " </td>
                    <td> " . $user['sex'] . " </td>
                    <td> " . $user['age'] . " </td>
                    <td> " . $user['hobby'] . " </td>
                    <td>
                        <a href='deleteUser.php?id=" . $user['id'] . "')>删除</a>
                        <a href='editUser.php?id=" . $user['id'] . "')>修改</a>
                        <a href='detailUser.php?id=" . $user['id'] . "')>查询</a>
                    </td>
                </tr>
            ";
        }
        ?>
    </table>
</body>
</html>